﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="FastSpring.Core.Model.User,FastSpring.Net.Core" table="Sys_User" lazy="false">
    <id name="UID" column="UID" type="Int32">
      <generator class="assigned" />
    </id>
    <property name="UserName" column="UserName"/>
    <property name="RealName" column="RealName"/>
    <property name="NickName" column="NickName"/>
    <property name="UserPass" column="UserPass"/>
    <property name="UserType" column="UserType"/>
    <property name="DPID" column="DPID"/>
    <property name="DepCode" column="DepCode"/>
    <property name="LanguageType" column="LanguageType"/>
    <property name="Sex" column="Sex"/>
    <property name="Birthday" column="Birthday"/>
    <property name="CreateIp" column="CreateIp"/>
    <property name="LastDate" column="LastDate"/>
    <property name="CreateDate" column="CreateDate"/>
    <property name="ExpiredDate" column="ExpiredDate"/>
    <property name="Description" column="Description"/>
    <property name="UserStatus" column="UserStatus"/>
    <property name="Phone" column="Phone"/>
    <property name="Email" column="Email"/>
    <property name="Country" column="Country"/>
    <property name="Area" column="Area"/>
    <property name="City" column="City"/>
    <property name="AddressInfor" column="AddressInfor"/>
    <property name="IsAuth" column="IsAuth"/>
    <property name="IsActive" column="IsActive"/>
    <property name="CID" column="CID"/>
    <property name="RID" column="RID"/>
    <property name="IsAllCp" column="IsAllCp"/>
    <bag name="UserCps" cascade="none" inverse="false" lazy="false" order-by="CID">
      <key column="UID"/>
      <one-to-many class="FastSpring.Core.Model.UserCp,FastSpring.Net.Core" />
    </bag>
  </class>
  <class name="FastSpring.Core.Model.UserCp,FastSpring.Net.Core" table="Sys_UserCp" lazy="false">
    <id name="ID" column="ID" type="Int32">
      <generator class="native" />
    </id>
    <property name="UID" column="UID"/>
    <property name="CID" column="CID"/>
    <property name="CompanyCode" column="CompanyCode"/>
    <property name="CompanyName" column="CompanyName"/>
  </class>
  <!--class name="FastSpring.Core.Model.User_Session,FastSpring.Net.Core" table="Sys_User_Session" lazy="false">
    <id name="IDKey" column="IDKey" type="string">
      <generator class="assigned" />
    </id>
    <property name="UID" column="UID"/>
    <property name="UserName" column="UserName"/>
    <property name="NickName" column="NickName"/>
    <property name="UserIp" column="UserIp"/>
    <property name="FirstDate" column="FirstDate"/>
    <property name="LastDate" column="LastDate"/>
    <property name="LastUrl" column="LastUrl"/>
  </class-->    
  <query name="GetUserByUserName">
    <![CDATA[from User user where user.UserName =:UserName]]>
  </query>
  <query name="GetUserByNickName">
    <![CDATA[from User user where user.NickName =:NickName]]>
  </query>
  <query name="GetUserByUserNameAndUserPass">
    <![CDATA[from User user where user.UserName =:UserName AND user.UserPass =:UserPass]]>
  </query>
  <query name="GetUsersList">
    <![CDATA[from User user ]]>
  </query>
  <query name="UserList">
    <![CDATA[Select user.UserName,user.UID from User user ORDER BY user.UserName]]>
  </query>
  <!-- 删除部门时查询此部门下是否有员工存在 -->
  <query name="GetUsersOfDCID">
    <![CDATA[from User user WHERE user.CID=:ParentID]]>
  </query>
  <!-- 删除角色时查询此部门下是否有员工存在 -->
  <query name="GetUsersOfRID">
    <![CDATA[from User user WHERE user.RID=:ParentID]]>
  </query>
</hibernate-mapping>